package com.awenhui.demo.demo.io;

import lombok.SneakyThrows;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.nio.file.Files;
import java.nio.file.OpenOption;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;

/**
 * 文件测试类
 */
public class FileTest {

    public static void main(String[] args) throws IOException {

        testFiles();
        //复制文件
        Files.copy(Paths.get("d:\\test\\1.txt"), new File("d:\\test\\2.txt").toPath());

    }

    @SneakyThrows
    static void testFiles() {
        byte[] bytes = Files.readAllBytes(Paths.get("d:\\test\\1.txt"));
        String text = new String(bytes, "UTF-8");
    }

}
